// 55. 跳跃游戏
package Leetcode_Second_Brush;

public class Solution055 {
    public boolean canJump(int[] nums) {
        int bound = 0;
        int maxPerStep = nums[0];
        for (int i = 0; i < nums.length; i++) {
            if (i == bound)
                bound = maxPerStep;
            maxPerStep = Math.max(maxPerStep, i + nums[i]);
            if (maxPerStep >= nums.length - 1)
                return true;
        }
        return false;
    }
}
